#ifndef DRAWABLE_H
#define DRAWABLE_H

/*!
 * \file      drawable.h
 * \brief     Mother of all Drawable Object in the project.
 * \author    Duriez Franck
 * \author    Carton Paul-Henri
 * \version   0.1
 *
 * This is an abstract class which defines what a Drawable Object
 * need to entail.
 */

#include <math.h>
#include <QObject>
#include "qsfmlwidget.h"

/*!
 * \struct Vector2i
 * \brief A vector with two integer componants : (x,y)
 */
typedef sf::Vector2i Vector2i;
/*!
 * \struct Vector2f
 * \brief A vector with two float componants : (x,y)
 */
typedef sf::Vector2f Vector2f;

/*!
 * \class  Drawable
 * \brief  Mother of all Drawable Object in the project.
 */
class Drawable : public QObject /*{{{*/
{
Q_OBJECT
/*{{{*/
public:
	/*!
	 * \brief Constructor.
	 * \param displayWidget : where display the new Objects
	 * \param parent        : parent of this
	 * \param dt            : pointer to the infinitesimal part of time
	 */
	explicit Drawable(QSFMLWidget* displayWidget, QObject* parent, float* dt);

	/*!
	 * \brief Destructor.
	 */
	virtual ~Drawable();

	/*!
	 * \brief Draw this.
	 */
	virtual void draw() const = 0;

	/*!
	 * \brief Update this.
	 */
	virtual void update() = 0;
/*}}}*/

	/********************
	 * ABSOLUTE SETTERS *
	 ********************/
/*{{{*/
public:
	/*!
	 * \brief Change the center.
	 * \param center : new position of the center
	 */
	virtual void setCenter(Vector2f center) = 0;

	/*!
	 * \brief Change the position.
	 * \param position : new position
	 */
	virtual void setPosition(Vector2f position) = 0;

	/*!
	 * \brief Change the angle.
	 * \param angle : new angle
	 */
	virtual void setRotation(float angle) = 0;
/*}}}*/

	/********************
	 * RELATIVE SETTERS *
	 ********************/
/*{{{*/
public:
	/*!
	 * \brief Move the center.
	 * \param dcenter : movement of the center
	 */
	virtual void moveCenter(Vector2f dcenter) = 0;

	/*!
	 * \brief Move the Object.
	 * \param dposition : movement of the Object
	 */
	virtual void move(Vector2f dposition) = 0;

	/*!
	 * \brief Rotate the Object.
	 * \param dangle : angle of rotation
	 */
	virtual void rotate(float dangle) = 0;
/*}}}*/

	/***********
	 * GETTERS *
	 ***********/
/*{{{*/
public:
	/*!
	 * \brief Return the center.
	 */
	virtual Vector2f getCenter() const = 0;

	/*!
	 * \brief Return the position.
	 */
	virtual Vector2f getPosition() const = 0;

	/*!
	 * \brief Return the angle.
	 */
	virtual float getRotation() const = 0;
/*}}}*/

	/***************
	 * DESCRIPTION *
	 ***************/
/*{{{*/
	/*!
	 * \brief Return a description.
	 */
	virtual std::string toString() const = 0;
/*}}}*/

	/**************
	 * ATTRIBUTES *
	 **************/
/*{{{*/
protected:
	QSFMLWidget* displayer; ///< Widget where display this
	float* dt; ///< Pointer to the infinitesimal part of time
/*}}}*/
}; /*}}}*/

#endif // DRAWABLE_H
